import api from './auth'

// 权限管理API
export const permissionAPI = {
  // 获取所有权限
  getPermissions: () => {
    return api.get('/permission')
  },

  // 根据ID获取权限
  getPermissionById: (id) => {
    return api.get(`/permission/${id}`)
  },

  // 添加权限
  addPermission: (data) => {
    return api.post('/permission', {
      permissionName: data.permissionName
    })
  },

  // 更新权限
  updatePermission: (id, data) => {
    return api.post(`/permission/${id}`, {
      permissionName: data.permissionName
    })
  },

  // 删除权限
  deletePermission: (id) => {
    return api.delete(`/permission/${id}`)
  }
}

export default permissionAPI
